package br.com.affero.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import br.com.affero.bean.User;
import br.com.affero.facade.DomainFacade;

public class PrepareAdminAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		// Carregando o usuário na sessão.
		// Poderia ser qualquer método para carregar usuário como por exemplo login e senha.
		User user = DomainFacade.getInstance().getUser(1);
		request.getSession().setAttribute("user", user);
		
		return mapping.findForward("list");
	}
	
}
